<%@ page pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<style type="text/css">
.error {
	display: inline;
	color: red;
	font-family: 黑体;
	font-size: 12px;
}

.error2 {
	color: red;
	font-family: 黑体;
	font-size: 12px;
}

.checkboxLabel {
	display: inline;
	font-size: 18px;
}
</style>
<script type="text/javascript">
	$("#menuForm").validator(
		{},
		{
			callback :function(results) {
			$("#menuForm").ajaxSubmit(function(data) {
				 menuMyDialog.close();
	        	 menuMyDialog = art.dialog({icon: data.success,content: data.message, lock:true}).time(1);
	        	 
	        	 if(data.success=='succeed') {
	    			var newNode = {id:data.data.id, name:data.data.text, pId:data.data.parentId};
	    	    			
	    	 		if (zTree.getSelectedNodes()[0]) {
	    				newNode.checked = zTree.getSelectedNodes()[0].checked;
	    				zTree.addNodes(zTree.getSelectedNodes()[0], newNode);
	    			} else {
	    				zTree.addNodes(null, newNode);
	    			} 
	        	 }
			});
		}
	});
	
	// 取消操作
	function cancelOpr() {
		menuMyDialog.close();
		return false;
	}
	
	function checkMenuName() {
		var result = new Object();
		
		var pattern = new RegExp("[`~!@#$^&*=|{}':;',\\[\\].<>/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]");
		if($.trim($("#text").val()) != "" && $.trim($("#text").val()).match(pattern)) {
			result.result = false;
			result.msg = "不能包含特殊字符";
			return result;
		}
		
		result.result = true;
		result.msg = "输入正确";
		
		return result;
	}
	

</script>

<form id="menuForm" method="post" action="cms/wechatmenu/add/submit"> 
	<input id="parentId" name="parentId" type="hidden" type="text" value="${parentId}"/>
	
	<ul class="all_list">
	     <li>
			<span class="all_title" ></span> 
			<span >
				注意：最多只能添加3个一级菜单
			</span>
		</li>
		<li id="orgTree001" class="dtree_frame" >
			<span class="all_title" style="width:120px;"> 父菜单：</span> 
			<span class="conent">
				${parentName}
			</span>
		</li>
		<li>
			<span class="all_title" style="width:120px;"> 菜单类型：</span> 
			<span>
				<input type="text" class="ui_input" id="type" name="type" value="view"  />
			</span>
		</li>
		<li id="orgTree001" class="dtree_frame" >
			<span class="all_title" style="width:120px;"> 菜单名称：</span> 
			<span class="conent">
				<input type="text" class="ui_input"
					id="text" name="text" value="" validator='{"label":"菜单名称","required":true,"maxLength":80, "customFun":"checkMenuName"}'/>
			</span>
		</li>
		<li>
			<span class="all_title" style="width:120px;"> 菜单URL：</span> 
			<span>
				<textarea rows="2" cols="60" name="url"   ></textarea>
			</span>
		</li>
		<li>
			<span class="all_title" style="width:120px;"> 菜单排序：</span> 
			<span>
				<input type="text" class="ui_input"
					id="showIndex" name="showIndex" value="" validator='{"label":"菜单排序","required":true,"isDigit":true,"maxLength":16}'/>
			</span>
		</li>
		<li>
			<span class="all_title"></span>
			<span> 
				<input type="button" class="btn_blue submitBtn" value="新 增" />
				<input type="button" class="btn_blue" value="取 消" name="button" id="cancel_button" onclick="cancelOpr()" /> 
			</span>
			</li>
		</ul>
	
</form>